home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / tex / tex31 / inputs.lzh / plain.tex < prev    next >
Text File  |  1990-04-04  |  44KB  |  1,230 lines

  1. % This is the plain TeX format that's described in The TeXbook.
  2. % N.B.: A version number is defined at the very end of this file;
  3. %       please change that number whenever the file is modified!
  4. % And don't modify the file under any circumstances.
  5.  
  6. \catcode`\{=1 % left brace is begin-group character
  7. \catcode`\}=2 % right brace is end-group character
  8. \catcode`\$=3 % dollar sign is math shift
  9. \catcode`\&=4 % ampersand is alignment tab
  10. \catcode`\#=6 % hash mark is macro parameter character
  11. \catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts
  12. \catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts
  13. \catcode`\^^I=10 % ascii tab is a blank space
  14. \chardef\active=13 \catcode`\~=\active % tilde is active
  15. \catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"
  16.  
  17. \message{Preloading the plain format: codes,}
  18.  
  19. % We had to define the \catcodes right away, before the message line,
  20. % since \message uses the { and } characters.
  21. % When INITEX (the TeX initializer) starts up,
  22. % it has defined the following \catcode values:
  23. % \catcode`\^^@=9 % ascii null is ignored
  24. % \catcode`\^^M=5 % ascii return is end-line
  25. % \catcode`\\=0 % backslash is TeX escape character
  26. % \catcode`\%=14 % percent sign is comment character
  27. % \catcode`\ =10 % ascii space is blank space
  28. % \catcode`\^^?=15 % ascii delete is invalid
  29. % \catcode`\A=11 ... \catcode`\Z=11 % uppercase letters
  30. % \catcode`\a=11 ... \catcode`\z=11 % lowercase letters
  31. % all others are type 12 (other)
  32.  
  33. % Here is a list of the characters that have been specially catcoded:
  34. \def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
  35.   \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
  36. % (not counting ascii null, tab, linefeed, formfeed, return, delete)
  37. % Each symbol in the list is preceded by \do, which can be defined
  38. % if you want to do something to every item in the list.
  39.  
  40. % We make @ signs act like letters, temporarily, to avoid conflict
  41. % between user names and internal control sequences of plain format.
  42. \catcode`@=11
  43.  
  44. % INITEX sets up \mathcode x=x, for x=0..127, except that
  45. % \mathcode x=x+"7100, for x = `A to `Z and `a to `z;
  46. % \mathcode x=x+"7000, for x = `0 to `9.
  47. % The following changes define internal codes as recommended
  48. % in Appendix C of The TeXbook:
  49. \mathcode`\^^@="2201 % \cdot
  50. \mathcode`\^^A="3223 % \downarrow
  51. \mathcode`\^^B="010B % \alpha
  52. \mathcode`\^^C="010C % \beta
  53. \mathcode`\^^D="225E % \land
  54. \mathcode`\^^E="023A % \lnot
  55. \mathcode`\^^F="3232 % \in
  56. \mathcode`\^^G="0119 % \pi
  57. \mathcode`\^^H="0115 % \lambda
  58. \mathcode`\^^I="010D % \gamma
  59. \mathcode`\^^J="010E % \delta
  60. \mathcode`\^^K="3222 % \uparrow
  61. \mathcode`\^^L="2206 % \pm
  62. \mathcode`\^^M="2208 % \oplus
  63. \mathcode`\^^N="0231 % \infty
  64. \mathcode`\^^O="0140 % \partial
  65. \mathcode`\^^P="321A % \subset
  66. \mathcode`\^^Q="321B % \supset
  67. \mathcode`\^^R="225C % \cap
  68. \mathcode`\^^S="225B % \cup
  69. \mathcode`\^^T="0238 % \forall
  70. \mathcode`\^^U="0239 % \exists
  71. \mathcode`\^^V="220A % \otimes
  72. \mathcode`\^^W="3224 % \leftrightarrow
  73. \mathcode`\^^X="3220 % \leftarrow
  74. \mathcode`\^^Y="3221 % \rightarrow
  75. \mathcode`\^^Z="8000 % \ne
  76. \mathcode`\^^[="2205 % \diamond
  77. \mathcode`\^^\="3214 % \le
  78. \mathcode`\^^]="3215 % \ge
  79. \mathcode`\^^^="3211 % \equiv
  80. \mathcode`\^^_="225F % \lor
  81. \mathcode`\ ="8000 % \space
  82. \mathcode`\!="5021
  83. \mathcode`\'="8000 % ^\prime
  84. \mathcode`\(="4028
  85. \mathcode`\)="5029
  86. \mathcode`\*="2203 % \ast
  87. \mathcode`\+="202B
  88. \mathcode`\,="613B
  89. \mathcode`\-="2200
  90. \mathcode`\.="013A
  91. \mathcode`\/="013D
  92. \mathcode`\:="303A
  93. \mathcode`\;="603B
  94. \mathcode`\<="313C
  95. \mathcode`\=="303D
  96. \mathcode`\>="313E
  97. \mathcode`\?="503F
  98. \mathcode`\[="405B
  99. \mathcode`\\="026E % \backslash
  100. \mathcode`\]="505D
  101. \mathcode`\_="8000 % \_
  102. \mathcode`\{="4266
  103. \mathcode`\|="026A
  104. \mathcode`\}="5267
  105. \mathcode`\^^?="1273 % \smallint
  106.  
  107. % INITEX sets \uccode`x=`X and \uccode `X=`X for all letters x,
  108. % and \lccode`x=`x, \lccode`X=`x; all other values are zero.
  109. % No changes to those tables are needed in plain TeX format.
  110.  
  111. % INITEX sets \sfcode x=1000 for all x, except that \sfcode`X=999
  112. % for uppercase letters. The following changes are needed:
  113. \sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0
  114. % The \nonfrenchspacing macro will make further changes to \sfcode values.
  115.  
  116. % Finally, INITEX sets all \delcode values to -1, except \delcode`.=0
  117. \delcode`\(="028300
  118. \delcode`\)="029301
  119. \delcode`\[="05B302
  120. \delcode`\]="05D303
  121. \delcode`\<="26830A
  122. \delcode`\>="26930B
  123. \delcode`\/="02F30E
  124. \delcode`\|="26A30C
  125. \delcode`\\="26E30F
  126. % N.B. { and } should NOT get delcodes; otherwise parameter grouping fails!
  127.  
  128. % To make the plain macros more efficient in time and space,
  129. % several constant values are declared here as control sequences.
  130. % If they were changed, anything could happen; so they are private symbols.
  131. \chardef\@ne=1
  132. \chardef\tw@=2
  133. \chardef\thr@@=3
  134. \chardef\sixt@@n=16
  135. \chardef\@cclv=255
  136. \mathchardef\@cclvi=256
  137. \mathchardef\@m=1000
  138. \mathchardef\@M=10000
  139. \mathchardef\@MM=20000
  140.  
  141. % Allocation of registers
  142.  
  143. % Here are macros for the automatic allocation of \count, \box, \dimen,
  144. % \skip, \muskip, and \toks registers, as well as \read and \write
  145. % stream numbers, \fam codes, \language codes, and \insert numbers.
  146.  
  147. \message{registers,}
  148.  
  149. % When a register is used only temporarily, it need not be allocated;
  150. % grouping can be used, making the value previously in the register return
  151. % after the close of the group.  The main use of these macros is for
  152. % registers that are defined by one macro and used by others, possibly at
  153. % different nesting levels.  All such registers should be defined through
  154. % these macros; otherwise conflicts may occur, especially when two or more
  155. % more macro packages are being used at once.
  156.  
  157. % The following counters are reserved:
  158. %   0 to 9  page numbering
  159. %       10  count allocation
  160. %       11  dimen allocation
  161. %       12  skip allocation
  162. %       13  muskip allocation
  163. %       14  box allocation
  164. %       15  toks allocation
  165. %       16  read file allocation
  166. %       17  write file allocation
  167. %       18  math family allocation
  168. %       19  language allocation
  169. %       20  insert allocation
  170. %       21  the most recently allocated number
  171. %       22  constant -1
  172. % New counters are allocated starting with 23, 24, etc.  Other registers are
  173. % allocated starting with 10.  This leaves 0 through 9 for the user to play
  174. % with safely, except that counts 0 to 9 are considered to be the page and
  175. % subpage numbers (since they are displayed during output). In this scheme,
  176. % \count 10 always contains the number of the highest-numbered counter that
  177. % has been allocated, \count 14 the highest-numbered box, etc.
  178. % Inserts are given numbers 254, 253, etc., since they require a \count,
  179. % \dimen, \skip, and \box all with the same number; \count 19 contains the
  180. % lowest-numbered insert that has been allocated. Of course, \box255 is
  181. % reserved for \output; \count255, \dimen255, and \skip255 can be used freely.
  182.  
  183. % It is recommended that macro designers always use
  184. % \global assignments with respect to registers numbered 1, 3, 5, 7, 9, and
  185. % always non-\global assignments with respect to registers 0, 2, 4, 6, 8, 255.
  186. % This will prevent ``save stack buildup'' that might otherwise occur.
  187.  
  188. \count10=22 % allocates \count registers 23, 24, ...
  189. \count11=9 % allocates \dimen registers 10, 11, ...
  190. \count12=9 % allocates \skip registers 10, 11, ...
  191. \count13=9 % allocates \muskip registers 10, 11, ...
  192. \count14=9 % allocates \box registers 10, 11, ...
  193. \count15=9 % allocates \toks registers 10, 11, ...
  194. \count16=-1 % allocates input streams 0, 1, ...
  195. \count17=-1 % allocates output streams 0, 1, ...
  196. \count18=3 % allocates math families 4, 5, ...
  197. \count19=0 % allocates \language codes 1, 2, ...
  198. \count20=255 % allocates insertions 254, 253, ...
  199. \countdef\insc@unt=20 % the insertion counter
  200. \countdef\allocationnumber=21 % the most recent allocation
  201. \countdef\m@ne=22 \m@ne=-1 % a handy constant
  202. \def\wlog{\immediate\write\m@ne} % write on log file (only)
  203.  
  204. % Here are abbreviations for the names of scratch registers
  205. % that don't need to be allocated.
  206.  
  207. \countdef\count@=255
  208. \dimendef\dimen@=0
  209. \dimendef\dimen@i=1 % global only
  210. \dimendef\dimen@ii=2
  211. \skipdef\skip@=0
  212. \toksdef\toks@=0
  213.  
  214. % Now, we define \newcount, \newbox, etc. so that you can say \newcoun